<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户密码修改</title>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://pic2.58.com/n/tuan/js/jquery-1.4.2.min.js"></script>
</head>
<body>
<script >
		function onblurCheckNewPwd(){
			var newpwd = $("#newpwd").val();
			if(newpwd.length > 0 && newpwd.length < 6 ){
				alert("您的密码长度太短，请输入至少6位密码！");
				$("#newpwd").val("");
			}
    	}
		
		
    	function onblurCheckPwd(){
			var newpwd = $("#newpwd").val();
			var checkpwd = $("#checkpwd").val();
			if(checkpwd.length > 0 && newpwd != checkpwd){
				alert("两次输入的密码不一致！请重新输入！");
				$("#checkpwd").val("");
			}
    	}
		
		
		 $(function(){$("#tochange").click(function(){ 
		 		jQuery.ajax({
						url:"/usermanager/tochangepwd",
						type:"post",
						async:true,
						data:{"username":$("#username").val(),"newpwd":$("#newpwd").val(),"oldpwd":$("#oldpwd").val()},
						success:function(data){
							if(data == "success"){
								alert("修改成功！");
							}else if (data == "pwdWrong"){
								alert("旧密码输入错误！请重试！");
								$("#oldpwd").val("");
								$("#newpwd").val("");
								$("#checkpwd").val("");
							}else{
								alert("修改失败！");
							}
						}
				});
			 })
		 })
</script>
<div class="lr_both">
<div class="right_conts">
  <div class="mg_tt">
    <div class="right_search">
      <div class="rs_title_bg">
        <h2 class="rs_title">修改密码</h2>
      </div>
	  
    </div>
	</br>
	</br>
	<form >
    <div class="table_div" align="center">
      <table class="sj_tl"  width="50%" border="0" cellspacing="0" cellpadding="0">
		<tr>
          <th align="center" colspan="2">用户基本信息</th>
		</tr>
		
        <tr>
          <td align="center"  width="40%" >用户编号</td>
		  <td align="center" width="60%" name="userid" id="userid">$!user.id</td>
        </tr>

        <tr>
           <td align="center" >用户名称</td>
		  <td align="center"  >$!user.username</td>
		  <input type="hidden" name="username" id="username" value="$!user.username"/>
        </tr>

		  <tr>
           <td align="center" >旧密码</td>
		  <td align="center" ><input type="password" name="oldpwd" id="oldpwd" /></td>
        </tr>
		
		  <tr>
           <td align="center" >新密码</td>
		  <td align="center" ><input type="password" name="newpwd" id="newpwd" onblur="onblurCheckNewPwd()" /></td>
        </tr>
		
		  <tr>
           <td align="center">密码确认</td>
		  <td align="center" ><input type="password" name="checkpwd" id="checkpwd" onblur="onblurCheckPwd()"/></td>
        </tr>
		
		<tr>
          <th align="center" colspan="2">
            <input type="button"  id="tochange" name="tochange"  value="保存"/>
			&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;	&nbsp;
			<input type="reset"    value="重置"/>
		  </th>
		</tr>
      </table>

    </div>
	 </form>
  </div>

</div>
</div>
</body>
</html>
